import time
import unittest
from selenium import webdriver
from selenium.webdriver.common.by import By


#新建一个类，打上unittest.TestCase
class Denglu(unittest.TestCase):

    # def setUp
    def setUp(self) :
        self.driver = webdriver.Chrome()
        self.driver.implicitly_wait(3)

    # def tearDown
    def tearDown(self) :
        self.driver.quit()
    # 测试方法1
    def test1(self):
        self.driver.get("http://192.168.46.5:18089/login")
        self.driver.find_element(By.NAME,"username").send_keys("XTGLY")
        self.driver.find_element(By.NAME, "password").send_keys("123456")
        self.driver.find_element(By.ID, "signIn").click()
        time.sleep(2)

    # 测试方法2
    def test2(self):
        self.driver.get("http://192.168.46.5:18089/login")
        self.driver.find_element(By.NAME, "username").send_keys("XTGLY")
        self.driver.find_element(By.NAME, "password").send_keys("123456")
        self.driver.find_element(By.ID, "signIn").click()
        time.sleep(2)
        self.driver.find_element(By.LINK_TEXT, "仓库信息").click()

# 输入main出现轮廓，  调用unittest.main()
if __name__ == '__main__':
    unittest.main()